package com.zhongyouyun.wx.wxapplet.cqyc.controller;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zhongyouyun.cqyc.model.BusinessHallModel;
import com.zhongyouyun.cqyc.model.ShouldKnowModel;
import com.zhongyouyun.cqyc.service.BusinessHallService;
import com.zhongyouyun.cqyc.service.ModuleSetService;
import com.zhongyouyun.cqyc.service.ShouldKnowService;
import com.zhongyouyun.other.model.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("wx/wxapplet/cqyc/businessHall")
@Api(value = "烟草城区-微信小程序业务大厅操作", tags = {"烟草城区-微信小程序业务大厅操作"})
public class WxAppletBusinessHallController {
    @Autowired
    private BusinessHallService businessHallService;
    @Autowired
    private ShouldKnowService shouldKnowService;


    @GetMapping("/getDetails")
    @ResponseBody
    @ApiOperation(value = "获取须知公告信息", notes = "获取须知公告信息")
    public Result getDetails(@ApiParam(name = "类型", value = "type", required = true) @RequestParam(value = "type") String type) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("type",type);
        List<ShouldKnowModel> list = shouldKnowService.selectList(queryWrapper);
        if (list.size() > 0) {
            ShouldKnowModel shouldKnowModel = list.get(0);
            return Result.builder().message("成功").status(0).data(shouldKnowModel).build();
        } else {
            return Result.builder().message("获取失败").success(false).status(1).build();
        }
    }
}
